/*
 * 作者：姚俊
 * 功能：查询获奖未审核的action
 * 日期：2015-06-08
 * 
 */
package admin.action.checkSearch;

import java.util.List;

import com.opensymphony.xwork2.ActionContext;

import admin.action.fruits.Constant;
import admin.service.fruits.AwardService;

import teacher.bean.Award;

public class SearchAwardUncheckAction {
	
	private List<Award> awards;
	//当前页
	private int currentPage;
	//最后一页
	private int endPage;
	private int counts;
	private int flag;

	public List<Award> getAwards() {
		return awards;
	}

	public void setAwards(List<Award> awards) {
		this.awards = awards;
	}
	
	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getEndPage() {
		return endPage;
	}

	public void setEndPage(int endPage) {
		this.endPage = endPage;
	}

	public int getCounts() {
		return counts;
	}

	public void setCounts(int counts) {
		this.counts = counts;
	}
	
	public int getFlag() {
		return flag;
	}

	public void setFlag(int flag) {
		this.flag = flag;
	}

	public String execute()
	{
		
		           //当前页为零的时候，把当前页变成1
				if(this.getCurrentPage()==0)
					this.setCurrentPage(1);
				
				int add=0;
				//最后一页
				if(new AwardService().getCountAwardByState(4)%Constant.pageSize!=0)
				{
					add=1;
				}
				
				System.out.println("当前页为:"+this.getCurrentPage());
				this.setEndPage(new AwardService().getCountAwardByState(4)/Constant.pageSize+add);
				this.setCounts(new AwardService().getCountAwardByState(4));
				ActionContext.getContext().put("flag", 3);
				this.setFlag(3);

				this.setAwards(new AwardService().getSegregateAwardByState(4,
						(this.getCurrentPage()-1)*Constant.pageSize+1,Constant.pageSize));

		return "succ";
	}

}
